/*++

Copyright (c) Microsoft Corporation. 
 
This source code is subject to terms and conditions of the Microsoft
Public License. A copy of the license can be found in the License.txt
file at the root of this distribution. By using this source code in 
any fashion, you are agreeing to be bound by the terms of the Microsoft
Public License.
 
You must not remove this notice, or any other, from this software.

Module Name:

    Queue.h

Abstract:

    This module contains the type definitions for the Generic serial driver
    driver's queue callback class.
--*/

#pragma once

class ATL_NO_VTABLE CMyQueue :
    public CComObjectRootEx<CComMultiThreadModel>,
    public IQueueCallbackDeviceIoControl,
    public IQueueCallbackCreate // Added to intercept calls to CreateFile
{
public:
    virtual ~CMyQueue();

    DECLARE_NOT_AGGREGATABLE(CMyQueue)

    BEGIN_COM_MAP(CMyQueue)
        COM_INTERFACE_ENTRY(IQueueCallbackDeviceIoControl)
        COM_INTERFACE_ENTRY(IQueueCallbackCreate) // Added to intercept calls to CreateFile
    END_COM_MAP()

    static HRESULT CreateInstance(__in IWDFDevice* pWdfDevice, CMyDevice* pMyDevice);

protected:
   CMyQueue();

// COM Interface methods
public:

    // IQueueCallbackCreate
    //
    STDMETHOD_ (void, OnCreateFile)(
        /*[in]*/ IWDFIoQueue *pQueue,
        /*[in]*/ IWDFIoRequest *pRequest,
        /*[in]*/ IWDFFile *pFileObject
        );

    // IQueueCallbackDeviceIoControl
    STDMETHOD_ (void, OnDeviceIoControl)(
        __in IWDFIoQueue*    pQueue,
        __in IWDFIoRequest*  pRequest,
        __in ULONG           ControlCode,
        SIZE_T          InputBufferSizeInBytes,
        SIZE_T          OutputBufferSizeInBytes
        );

private:
    CMyDevice*          m_pParentDevice; // Parent device object
    LONG    m_cRefs;
};

